<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>留言</title>

    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>

</head>
<body>
<div id="blank" class="header">
    <div id="back" v-back.tapmode class="back"></div>
    <span class="title">留言</span>
</div>
<div id="app" class="top-container">
    <div class="feedback-textarea">
        <textarea v-model="feedback" placeholder="请输入您的意见，您的意见就是我们前进的动力"></textarea>
    </div>
    <a class="btn-commit" v-myclick="sendFeedback">提交</a>
</div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script>

    apiready = function () {
        setBSImg();
        new Vue({
            el: '#blank'
        });
        initApp();
        api.parseTapmode();
        addListeners();
    };

    function initApp() {
        new Vue({
            el: '#app',
            data: {
                feedback: ''
            },
            methods:{
                sendFeedback:function () {
                    showProgress();
                    var data = {
                        member_id:getPrefs('member_id'),
                        content:this.feedback
                    };
                    var callback = function (ret) {
                        api.alert({
                            title: '提示',
                            msg: '感谢您的留言,我们会努力做的更好!',
                            buttons: ['确定']
                        }, function (ret, err) {});
                        closeWin();
                    };
                    pinet.post(URL.sendFeedback, data, callback);
                }
            }
        })
    }

    function addListeners() {
        api.addEventListener({
            name: 'viewappear'
        }, function () {
            onPageStart();
        });

        api.addEventListener({
            name: 'viewdisappear'
        }, function (ret, err) {
            onPageEnd();
        });

        api.addEventListener({
            name: 'keyback'
        }, function (ret, err) {
            onPageEnd();
            api.closeWin();
        });
    }

</script>
</html>
